package schoolWork.work05.test1;

import javax.swing.*;
import java.awt.*;

public class MyJFrame extends JFrame {
    Box boxV1,boxV2,baseBox;
    JButton btn1,btn2,btn3;
    public MyJFrame(){

        boxV1 = Box.createVerticalBox();
        boxV1.add(new JLabel("Input your name:"));
        boxV1.add(Box.createVerticalStrut(8));
        boxV1.add(new JLabel("Input your job:"));
        boxV1.add(Box.createVerticalStrut(8));
        boxV1.add(new JLabel("Input your email:"));

        boxV2 = Box.createVerticalBox();
        boxV2.add(new JTextField(16));
        boxV2.add(Box.createVerticalStrut(8));
        boxV2.add(new JTextField(16));
        boxV2.add(Box.createVerticalStrut(8));
        boxV2.add(new JTextField(16));

        baseBox = Box.createHorizontalBox();
        baseBox.add(boxV1);
        baseBox.add(Box.createHorizontalStrut(10));// 添加一个空格
        baseBox.add(boxV2);

        JPanel jPanel = new JPanel();
        jPanel.add(btn1 = new JButton("OK"));
        jPanel.add(btn2 = new JButton("Cancel"));
        jPanel.add(btn3 = new JButton("Return"));

        this.add(baseBox, BorderLayout.CENTER);
        this.add(jPanel, BorderLayout.SOUTH);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(300,300,300,150);
        setVisible(true);
    }
}
